package Cordiali_Es2;

import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;

import Cordiali_Es2.Server.QueueType;
import arjuna.*;
import arjuna.JavaSim.Distributions.ErlangStream;
import arjuna.JavaSim.Distributions.ExponentialStream;
import arjuna.JavaSim.Distributions.HyperExponentialStream;
import arjuna.JavaSim.Distributions.RandomStream;
import arjuna.JavaSim.Distributions.SeedsData;
import arjuna.JavaSim.Distributions.UniformStream;
import arjuna.JavaSim.Simulation.Scheduler;
import arjuna.JavaSim.Simulation.SimulationProcess;
import arjuna.JavaSim.Statistics.Variance;

@SuppressWarnings("unused")

public class NumeriCasuali_2 {
	static double lambda = 1/0.1;
	static int tests = 10;
	static int erlang_steps = 5;
	static double p1 = 0.7;
	static RandomStream GetStream(SeedsData data){
		int type=4;
		if(type==0)
		{
			if(data==null)
				return new UniformStream(0,1);
			else
				return new UniformStream(0,1, data.MSeed, data.LSeed, data.series);
		}
		else if(type==1)
		{
			if(data==null)
				return new ExponentialStream(lambda);
			else
				return new ExponentialStream(lambda, data.MSeed, data.LSeed, data.series);
		}
		else if(type==2)
		{
			if(data==null)
				return new ErlangStream(lambda, erlang_steps);
			else
				return new ErlangStream(lambda, erlang_steps, data);
		}
		else
		{
			if(data==null)
				return new HyperExponential2OrderStream(lambda, p1);
			else
				return new HyperExponential2OrderStream(lambda, p1, data);
		}
	}
	/**
	 * @param args
	 */
	public static void main(String[] args)
	{
		
		
		Double[][] results = new Double[tests][2];
		RandomStream stream1 = GetStream(null);
		RandomStream stream2 = GetStream(null);
		try {
			for(int i=0;i<tests;i++)
			{
				results[i][0]=stream1.getNumber();
				results[i][1]=stream2.getNumber();
				if(i==tests/2)
				{
					System.err.println("cambio");
					stream2 = GetStream(stream2.GetSeedsData());
				}
			}
			
			System.out.println("Sequenza 1\t\tSequenza 2 (con due generatori)");
			for(int i=0;i<tests;i++)
			{
				System.out.println(results[i][0] + "\t" + results[i][1]);
			}
		}
		catch (ArithmeticException e) {}
		catch (IOException e) {}
	}
}
